package com.monlyu.action.devices;

import com.monlyu.action.PageAction;
import com.monlyu.bean.Pages;
import com.monlyu.bo.DevicesBo;
import com.monlyu.vo.Devices;

/**
 * @author SongJun
 * @since 2010-2-23
 * @description 设备信息列表
 */
public class ListDevicesAction extends PageAction {

	private DevicesBo devicesBo;
	private Devices device;
	private Pages<Devices> devices;
	
	public Devices getDevice() {
		return device;
	}


	public void setDevice(Devices device) {
		this.device = device;
	}


	public Pages<Devices> getDevices() {
		return devices;
	}


	public void setDevicesBo(DevicesBo devicesBo) {
		this.devicesBo = devicesBo;
	}


	@Override
	public String execute() throws Exception {
		devices = devicesBo.getDevicesList(getDefPage());
		return view("listDevices.jsp");
	}
	public String toDelete() throws Exception{
		devicesBo.deleteById(device.getId());
		devices = devicesBo.getDevicesList(getDefPage());
		return view("listDevices.jsp");
	}
	public String toEnable() throws Exception{
		devicesBo.toEnableDevice(device.getId());
		devices = devicesBo.getDevicesList(getDefPage());
		return view("listDevices.jsp");
	}
	
}
